package Thread_;

class MyThread02 implements Runnable{
    @Override
    public void run() {
        while(true){
            System.out.println("Thread01 run()");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Thread02 {
    public static void main(String[] args) {
        MyThread02 runnable = new MyThread02();
        Thread thread1 = new Thread(runnable);//Runnable接口需要搭配Thread类使用,才能真正在系统中创建出线程来
        thread1.start();
        while(true){
            System.out.println("main()");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
